package com.liner.homework.second;


import java.util.Arrays;

public class RefArrayDemo {
    public static void main(String[] args) {
        Dog[] dogs = new Dog[3];
        Chick[] chicks = new Chick[3];
        Fish[] fish = new Fish[2];

        dogs[0] = new Dog("拉布拉多", "白色", 12);
        dogs[1] = new Dog("香肠犬", "香肠色", 10);
        dogs[2] = new Dog("柴犬", "棕色", 2);

        fish[0] = new Fish("鲤鱼", "粉色", 4);
        fish[1] = new Fish("小丑鱼", "黄色", 3);

        chicks[0] = new Chick("小亮", "金色", 3);
        chicks[1] = new Chick("小黑", "黑色", 7);
        chicks[2] = new Chick("小明", "绿色", 9);

        for (Dog dog : dogs) {
            System.out.println("我的名字是:" + dog.name + ",已经" + dog.age + "岁了,颜色是:" + dog.color);
            dog.eat();
            dog.drink();
            dog.lookHome();
        }

        for (Chick chick : chicks) {
            System.out.println("我的名字是:" + chick.name + ",已经" + chick.age + "岁了,颜色是:" + chick.color);
            chick.eat();
            chick.drink();
            chick.layEggs();
        }



        for (Fish fish1 : fish) {
            System.out.println("我的名字是:" + fish1.name + ",已经" + fish1.age + "岁了,颜色是:" + fish1.color);
            fish1.eat();
            fish1.drink();
            fish1.swim();
        }


    }
}
